using System;
using System.Runtime.InteropServices;

namespace Fireball.ArchLinux.Pacman
{
    /// <summary>
    /// 
    /// </summary>
	public class PackagesApi
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="filename"></param>
		/// <param name="package"></param>
        /// <returns>0 on success, -1 on error (pm_errno is set accordingly)</returns>
		[DllImport("libalpm")]
		public extern static int alpm_pkg_load(string filename, out pmpkg package);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="package"></param>
        /// <returns>0 on success, -1 on error (pm_errno is set accordingly)</returns>
		[DllImport("libalpm")]
		public extern static int alpm_pkg_free(IntPtr package);
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="package"></param>
        /// <returns>0 on success, -1 on error (pm_errno is set accordingly)</returns>
		[DllImport("libalpm")]
		public extern static int alpm_pkg_checksha1sum(IntPtr package);	

        /// <summary>
        /// 
        /// </summary>
        /// <param name="package"></param>
        /// <returns>0 on success, -1 on error (pm_errno is set accordingly)</returns>
		[DllImport("libalpm")]
		public extern static int alpm_pkg_checkmd5sum(IntPtr package);	
				
		/// <summary>
		/// 
		/// </summary>
		/// <param name="version1"></param>
		/// <param name="version2"></param>
        /// <returns>Positive, 0 or negative if ver1 is less, equal or more than ver2,respectively</returns>
		[DllImport("libalpm")]
		public extern static int alpm_pkg_vercmp(string version1,string version2);	
	}
}